<template>
  <el-form
    :model="form"
    :rules="rules"
    ref="form"
    label-width="80px"
    v-loading="loading"
  >
    <el-form-item label="昵称" prop="displayName">
      <el-input v-model="form.displayName"></el-input>
    </el-form-item>

    <el-form-item label="用户ID" prop="uid" v-if="form.uid">
      <el-input v-model="form.uid" disabled></el-input>
    </el-form-item>

    <el-form-item label="头像" prop="portrait">
      <el-input v-model="form.portrait" placeholder="请输入头像url"></el-input>
    </el-form-item>

    <el-form-item label="账号" prop="name">
      <el-input v-model="form.name"></el-input>
    </el-form-item>

    <el-form-item label="手机号" prop="mobile">
      <el-input v-model="form.mobile"></el-input>
    </el-form-item>

    <el-form-item label="地址" prop="address">
      <el-input v-model="form.address"></el-input>
    </el-form-item>

    <el-form-item label="公司" prop="company">
      <el-input v-model="form.company"></el-input>
    </el-form-item>

    <el-form-item label="邮箱" prop="email">
      <el-input v-model="form.email"></el-input>
    </el-form-item>

    <el-form-item label="密码" prop="password">
      <el-input v-model="form.password"></el-input>
    </el-form-item>

    <el-form-item label="性别" prop="gender">
      <el-radio-group v-model="form.gender">
        <el-radio label="0">暂不选择</el-radio>
        <el-radio label="1">男</el-radio>
        <el-radio label="2">女</el-radio>
      </el-radio-group>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      fileList: [],
      form: {},
      rules: {
        id: [{ required: true, message: "请输入", trigger: "blur" }],
        url: [{ required: true, message: "请输入", trigger: "blur" }],
      },
      loading: false,
    };
  },
  created() {},
  methods: {
    init(row) {
      this.form = row;
      this.form.password = "";
      this.form.userId = this.form.uid;
      this.form.phone = this.form.mobile;
      console.log("this.form", this.form);

      this.$refs.form.clearValidate();
    },
    validate(cb) {
      this.$refs.form.validate((valid) => {
        if (!valid) {
          return;
        }
        console.log("this.form", this.form);
        cb(this.form);
      });
    },
  },
};
</script>

<style>
</style>